package com.beans;

import com.dao.CateDao;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

public class Goodsinfo {
    private Integer id;
    private String goodsName;
    private Integer bigCateId;
    private Integer smallCateId;
    private Double price;
    private String des;
    private String unit;
    private String producter;
    private Date editDate;
    private byte[] pictureData;
    CateDao cateDao=new CateDao();
    public String bigC(){
        List<Cateinfo> cate=cateDao.getlist();
        for(Cateinfo c:cate){
            if(c.getId()==bigCateId){
                return c.getCateName();
            }
        }
        return null;
    }
    public String smallC(){
        List<Cateinfo> cate=cateDao.getlist();
        for(Cateinfo c:cate){
            if(c.getId()==smallCateId){
                return c.getCateName();
            }
        }
        return null;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public Integer getBigCateId() {
        return bigCateId;
    }

    public void setBigCateId(Integer bigCateId) {
        this.bigCateId = bigCateId;
    }

    public Integer getSmallCateId() {
        return smallCateId;
    }

    public void setSmallCateId(Integer smallCateId) {
        this.smallCateId = smallCateId;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public String getDes() {
        return des;
    }

    public void setDes(String des) {
        this.des = des;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getProducter() {
        return producter;
    }

    public void setProducter(String producter) {
        this.producter = producter;
    }

    public Date getEditDate() {
        return editDate;
    }

    public void setEditDate(Date editDate) {
        this.editDate = editDate;
    }

    public byte[] getPictureData() {
        return pictureData;
    }

    public void setPictureData(byte[] pictureData) {
        this.pictureData = pictureData;
    }

    @Override
    public String toString() {
        return "Goodsinfo{" +
                "id=" + id +
                ", goodsName='" + goodsName + '\'' +
                ", bigCateId=" + bigCateId +
                ", smallCateId=" + smallCateId +
                ", price=" + price +
                ", des='" + des + '\'' +
                ", unit='" + unit + '\'' +
                ", producter='" + producter + '\'' +
                ", editDate=" + editDate +
                ", pictureData=" + Arrays.toString(pictureData) +
                '}';
    }
}
